Repository navigation
Conversation
Ports energy-models#1014 alone onto energy-models#1015's maps, without energy-models#1012 or energy-models#1013. A dimension takes `over:` and `missing:`; each member is an implied map of the dimension, read as `connection[unit]`, beside the maps the file declares under `maps: connection:`. A declared map named after a member is refused. A bound over a member suggests a constraint through `at`, since a bound does not read through a map here. Co-Authored-By: Fabian Hofmann <fab.hof@gmx.de> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
With the alias underneath, a dimension's members are a list of
dimensions, each once. The role form (`over: {from: region, to:
region}`) is gone: a tuple that holds one dimension twice lists an alias
of it as a member, and `over: [region, region]` is refused with the alias
as the rewrite. The two branches that only roles reached are removed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
…maps-tuple-dimensions
The TIMES trade example in this PR's spelling: top_ire is a dimension over the two aliases and the two plain dimensions, and ire_flo, trade_cost and export are over it. capacity.yaml keeps its relations: rtp_vintyr has an ordered member, which a tuple dimension cannot step along. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
…maps-tuple-dimensions
sparse.yaml in this PR's spelling: connection is a dimension over unit and port, capacity is read through at(), the sum per unit groups by the member, and active stays a relation because ramp_up steps along its ordered member. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
The TIMES trade example in this spelling: top_ire is a dimension over the two aliases, the two plain dimensions and process, and ire_flo, trade_cost and export are over it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA494URRSeWy6wmELGP
…used A dims: list reaches each member once. Two dimensions that share a member, or a dimension beside one of its own members, are refused at load, in place of the cross product they meant. The message names the shared member and the rewrite: one of the two with a where: through a relation, or an alias. The same holds for a piecewise entry's dims:. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA494URRSeWy6wmELGP
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA494URRSeWy6wmELGP
On an entry over every member, as plain dimensions, the bare name of a dimension with members keeps the coordinates whose member tuple it lists. It aligns nothing by name. An entry missing a member is refused with the frame rewrite. It prints as the tuple of the member indices. The shared-member and order refusals name the bare name as their rewrite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA494URRSeWy6wmELGP
No example has relations: any more. Each relation becomes a dimension over its members, with an alias where it held one dimension twice (ts_map, the PyPSA maintenance covers). Sums and lookups read through the members with at(); act is confined with where: "prc_ts AND rtp_vintyr". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA494URRSeWy6wmELGP
shift, sum_back and position along a member of an entry over the tuple were refused without a rewrite, or with an at() that does not apply. The message now names the entry over the members, confined with where: <tuple>. The data contract leaves the storage of a tuple to the tool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA494URRSeWy6wmELGP
`maps:` is renamed to `mappings:`, `MapSpec` to `MappingSpec` and `Spec.maps` to `Spec.mappings`. Messages, docstrings, the reference, the examples and the figures say "mapping", and a read is written `subject[mapping]`. The math symbol of a group stays `map(t)`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA4HppT8Z4pzepcHkj9
The alias's own code follows the rename: an alias has the mapping `<alias>[<target>]`, the refusal of that mapping declared again reads `mappings:`, and the notation rows say "mapping". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA4HppT8Z4pzepcHkj9
A set of combinations of labels is a dimension with over:. The schema refuses relations: as an unknown key, and the program keeps one table per subject with maps or members. The maps page replaces the relations page; the reference, limits.md and the explanation pages say the same. A tuple named only in a where: counts as a use for check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA494URRSeWy6wmELGP
The base renames maps: to mappings:. The merge takes this branch's side in every conflict, then applies the rename to this branch's own lines: MapSpec, Spec.mappings, mappings:, subject[mapping], and "mapping" in messages, docstrings, tests and pages. The page maps.md is mappings.md. The verb, Python's Mapping, the maths map(t) and linear maps stay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA494URRSeWy6wmELGP
FBumann
pushed a commit
that referenced
this pull request
Nov 17, 2026
Four refusals of #9 become the spelling each one stood for: - an operand over a member meets the dimension: read at each tuple, as at(x, by=dimension[member]) reads it; - sum(x, over=member) on an operand over the dimension: the sum through the dimension, grouped by the members over= leaves; - two dimensions in one dims: that share a member: the entry over the members, where: the dimensions; - a step along a member: the entry it steps in, and the entry it steps, over the members, where: the dimension. Every spec #9 loads builds the same program. A parameter over the members carries the tuples as its domain, where a tool refuses a stray row; that is the one change no #9 spelling states. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA494URRSeWy6wmELGP
FBumann
pushed a commit
that referenced
this pull request
Nov 17, 2026
…strict The tree is the restack's: #8's design as the four lifts over #9. The second parent keeps #8's earlier history, so the push fast-forwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA494URRSeWy6wmELGP
This was referenced Nov 17, 2026
FBumann
pushed a commit
that referenced
this pull request
Nov 19, 2026
…used A dims: list reaches each member once. Two dimensions that share a member, or a dimension beside one of its own members, are refused at load, in place of the cross product they meant. The message names the shared member and the rewrite: one of the two with a where: through a relation, or an alias. The same holds for a piecewise entry's dims:. Two dimensions over different aliases of one dimension share no member, so the alias is the opt-in to their cross product. (cherry picked from commit 0cbb7fa of #9) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018B3nA494URRSeWy6wmELGP Claude-Session: https://claude.ai/code/session_018B3nA1xxh6NMJN6mrYY34Q
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
The following content was generated by AI.
The strict tuple dimension of energy-models#1011: opaque,
at()required, every rule a refusal. Loosening it later only removes refusals; no spec that loads changes meaning.relations:section. A set of combinations of labels is a dimension withover:. The closed schema refusesrelations:as an unknown key.maps:ismappings:, from the base (energy-models/mathspecfeat/dimension-aliasat06e52956), applied to this PR's own code too.A relation becomes a tuple dimension:
examples/sparse.yaml, before (feat/dimension-alias):After (this PR, loads with
to_spec):TIMES (
examples/times/):(before:
actwithwhere: rtp_vintyr AND prc_tsover two relations;ire_floover the five dims withwhere: top_ire.)Draft, for comparison, not for merge. Siblings: #7 (Confine), #8 (multi-dims as members).
16f558c), merged withfeat/dimension-alias(96c1002, then06e52956).The border
A tuple used whole is allowed. Reaching inside it without
at()is refused, and each message names the spelled-out form.dims:;over=<tuple>; its bare name as a condition on an entry over every member; mappings keyed by it, read asconnection[bus].at(…, by=connection[member]).flow <= at(capacity, by=connection[unit])flow <= capacityover=<member>on an operand over the tuplesum(flow, over=connection, by=connection[unit])sum(flow, over=port)dims:dims: [connection, bus], where: "at(site, by=connection[unit])", or an aliasdims: [connection, site], joined onunitshift,sum_back,positionalong a member of an entry over the tupledims: [period, unit], where: active, thenshift(output, along=period, offset=1)dims: [active]with the sameshiftdims: [connection, active]). feat(language)!: a dimension lists its members, strictly #9'swhere: activedrops the row.dims:follows the spec, not the design. It is the same in feat(language): a dimension's members are read by name #8 and feat(language)!: a dimension lists its members, strictly #9 wherever feat(language)!: a dimension lists its members, strictly #9 admits the tuple indims:. Where feat(language)!: a dimension lists its members, strictly #9 refuses (a step along a member, two tuples sharing a member), feat(language): a dimension's members are read by name #8 also accepts feat(language)!: a dimension lists its members, strictly #9's flat spelling. So the shape of a constraint'sdualis the same.Rules of energy-models#1011 → refusal or meaning
over:makes the label a tuple; one dimension in every operatordim[member],missing: refusedat(x, by=connection[unit])is what alignment by name would computeflow <= capacity)at(capacity, by=connection[unit])sum(flow, over=unit)on an operand over the tuplesum(…, over=connection, by=connection[port])over:ordered,dtype,one_ofbesideover:where: <tuple>dims:(two tuples, or a tuple and its member)missing: absent / refusedsostype 1 along the tupleMethod, gate output, what was not done
Method
feat/maps-tuple-dimensions(16f558c) + merge of the fork'sfeat/dimension-alias(96c1002). Conflicts in the TIMES trade example and its page: took the base'sprocessmember, kepttop_irea dimension, rewrote the prose, regenerated._validation._shared_members, on every frame and onpiecewise:dims:. Test first:test_a_member_shared_by_two_dimensions_of_one_frame_is_refusedfailed on the merged tree;test_the_rewrite_of_a_shared_member_loadsholds the message to a rewrite that loads.RelationDefined(<tuple>, <member dims>); the frame check refuses it where a member is missing. Tests first, watched failing. Typesetting printed(a) ∈ active;test_a_membership_test_prints_the_member_indicesfailed in all three formats and passes now.shift,sum_backandpositionalong a member of an entry over the tuple were refused without the flat form.test_a_step_along_a_member_of_an_entry_over_the_tuple_names_the_flat_entryfailed for all three, and passes with_dimensions._step_member.relations:.RelationSpec,Spec.relations, the relation validators, the'relation'name kind and its branches, and the relation sections ofmerge,override,renameand the PyPSA splitter are gone.Program.relationsstays as the internal table of each subject with mappings or members.test_a_relations_section_is_refused_by_the_schemais the one test of the refusal.checkcounted a tuple named only in awhere:as never used;test_a_member_does_not_count_as_a_use[a-where-tests-the-dimension]failed first, and passes now.test_dimensions.py,test_validation.py,test_piecewise.pywalks into a relation) are deleted with the construct. The tuple's reads through its members and the refusals with theirat()rewrites are intests/test_tuple_dimensions.py.missing:rules are deleted. A tuple'smissing:is intest_missing_says_whether_the_full_product_is_required, and fragments disagreeing on it intest_two_fragments_that_say_different_things_about_one_entry_are_refused.UNREADfixture, the fluxopt investment curve (INVESTED), the lowering of a join (test_a_tuple_lowers_with_the_join_each_call_names), the renaming class, the compositionWIREDfixture, the spec-mutation probes, the parameter-mask fixtures.mappings:merge.feat/dimension-aliasat06e52956, fetched from upstream because the fork's branch was still at96c1002. 56 files conflicted. In each conflict this branch's side was taken, and the hunks git merged cleanly kept the base's rename. Then the rename was applied to every line that differs from the base:MappingSpec,Spec.mappings,mappings:,subject[mapping], and "mapping" in messages, docstrings, tests and pages. The verb, Python'sMapping, the mathsmap(t)and "linear maps" stay. The pagemaps.mdismappings.md.sparse,connection, bothoperators/sum_by_*,times/capacity,pypsaand its split fragments; no example hasrelations:.mappings.md(Mappings), with every link re-pointed. The pages updated:dimensions.md,expressions.md,parameters-variables-constraints.md,absence.md,file.md,operators.md,composition.md,reading.md,glossary.md, the how-to,limits.md(a row for the removed section),sql-and-dataframes.md, the PyPSA reference README, and "Mappings as linear maps". Figures with the old spelling are updated, and generated files regenerated.Gate (no pixi here; uv venv with the pinned tools, on
b8a42448)ruff check,ruff format --check,pyrefly check(0 errors),prettier --check,typos,reuse lint,git diff --check. All pass. Not run:taplo,zizmor, lefthook itself.pytest -q -n auto: 4266 passed, 3 skipped.python -m zensical build --strict: no issues.python -m tools.render_tex: 62 specs rendered.compile-tex: not run. tectonic is not installed here.Not done
feat/dimension-aliasis still at96c1002. Until it is fast-forwarded to06e52956, this diff also shows the base's rename.check_meetingand the guard of rule 12 can no longer be reached. Left in place.compare/multi-dims, which this session's brief kept out of reach.🤖 Generated with Claude Code
https://claude.ai/code/session_018B3nA494URRSeWy6wmELGP